Sharded recovery test migrated in go#5684
Conversation
Signed-off-by: saurabh <saurabh.408@gmail.com>
Signed-off-by: saurabh <saurabh.408@gmail.com>
| for i := 0; i < tabletsRequired; i++ { | ||
| tabletType := "replica" | ||
| if i == 0 { | ||
| tabletType = "master" |
There was a problem hiding this comment.
You don't need to do this if you are doing initShard master
| shard0RdOnly = localCluster.Keyspaces[0].Shards[1].Vttablets[2] | ||
| shard1Master = localCluster.Keyspaces[0].Shards[2].Vttablets[0] | ||
| shard1Replica = localCluster.Keyspaces[0].Shards[2].Vttablets[1] | ||
| shard1RdOnly = localCluster.Keyspaces[0].Shards[2].Vttablets[2] |
There was a problem hiding this comment.
Maybe a better way to create these objects first and then add them into shard(s) and then loop those shards to create mysql processes. Check resharding_base for example.
| if err = localCluster.VtctlclientProcess.InitTablet(rdOnly, cell, keyspaceName, hostname, shard.Name); err != nil { | ||
| return 1, err | ||
| } | ||
|
|
There was a problem hiding this comment.
On same principle, you can loop shard tablets to run InitTablet
| // we need to create the schema, and the worker will do data copying | ||
| for _, keyspaceShard := range []string{"test_keyspace/-80", "test_keyspace/80-"} { | ||
| err = localCluster.VtctlclientProcess.ExecuteCommand("CopySchemaShard", "test_keyspace/0", keyspaceShard) | ||
| assert.Nil(t, err) | ||
| } | ||
|
|
||
| err = localCluster.VtctlclientProcess.ExecuteCommand("SplitClone", "test_keyspace", "0", "-80,80-") | ||
| assert.Nil(t, err) | ||
|
|
||
| err = localCluster.VtctlclientProcess.ExecuteCommand("MigrateServedTypes", "test_keyspace/0", "rdonly") | ||
| assert.Nil(t, err) | ||
|
|
||
| err = localCluster.VtctlclientProcess.ExecuteCommand("MigrateServedTypes", "test_keyspace/0", "replica") | ||
| assert.Nil(t, err) | ||
|
|
||
| // then serve master from the split shards | ||
| err = localCluster.VtctlclientProcess.ExecuteCommand("MigrateServedTypes", "test_keyspace/0", "master") | ||
| assert.Nil(t, err) |
There was a problem hiding this comment.
@sougou should we change this to use the new Reshard, MigrateReads and MigrateWrites?
There was a problem hiding this comment.
We should write separate tests for the new workflows. @rohit-nayak-ps is taking this on.
| // check that new tablet is accessible with 'use ks' | ||
| executeQueriesUsingVtgate(t, session, "use recovery_keyspace@replica") | ||
| verifyQueriesUsingVtgate(t, session, "select count(*) from vt_insert_test", "INT64(2)") | ||
|
|
There was a problem hiding this comment.
We should also test the case that we weren't able to test in python:
https://github.com/vitessio/vitess/blob/master/test/sharded_recovery.py#L382
| // check that new keyspace is accessible with 'use ks' | ||
| executeQueriesUsingVtgate(t, session, "use recovery_keyspace@replica") | ||
| verifyQueriesUsingVtgate(t, session, "select count(*) from vt_insert_test", "INT64(2)") | ||
|
|
There was a problem hiding this comment.
Same here, we should add testing for keyspace:shard@replica
https://github.com/vitessio/vitess/blob/master/test/sharded_recovery.py#L611
Signed-off-by: saurabh <saurabh.408@gmail.com>
Signed-off-by: saurabh <saurabh.408@gmail.com>
Signed-off-by: saurabh <saurabh.408@gmail.com>
Sharded recovery tests the following :